package org.jz.gae.redbook.spb.client;

import org.jz.gae.redbook.spb.client.slate.family.FamilySlate;
import org.jz.gae.redbook.spb.client.slate.menu.MenuSlate;
import org.jz.gae.redbook.spb.client.toolkit.ApplicationContainer;
import org.jz.gae.redbook.spb.shared.FieldVerifier;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.maps.client.Maps;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class RedBookSpb implements EntryPoint {
	/**
	 * The message displayed to the user when the server cannot be reached or
	 * returns an error.
	 */
	private static final String SERVER_ERROR = "An error occurred while "
			+ "attempting to contact the server. Please check your network "
			+ "connection and try again.";

	/**
	 * Create a remote service proxy to talk to the server-side Greeting service.
	 */
	
	private static final String GOOGLE_MAPS_KEY = "AIzaSyCo5KfN7WrTjDK_L9uAouCqfV8lHndhnts";

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() 
	{
		Maps.loadMapsApi(GOOGLE_MAPS_KEY, "2", false, new Runnable()
		{
		    @Override
		    public void run()
		    {
			    RedBookServiceAsync rpcService = GWT.create(RedBookService.class);
			    HandlerManager eventBus = new HandlerManager(null);
			    ApplicationContainer applicationContainer = new ApplicationContainer();
			    applicationContainer.setEventBus(eventBus);
			    applicationContainer.setRpcService(rpcService);
			    RootPanel.get("slateBodyContainer").add(applicationContainer);
			    //appViewer.go(RootPanel.get("slateBodyContainer"));
			    /**/
			    //NavigationMenu navigationMenu = new NavigationMenu(eventBus);
			    //RootPanel.get("navigationMenuContainer").add(navigationMenu.getWidget());
			    /**/
			    applicationContainer.openSlate(new MenuSlate());
		    }	
		});
		
	}
}
